﻿package net.wangit.jdbc.sqltype;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;

public class StringSqlType implements SqlType {

	private static final long serialVersionUID = 1L;

	public StringSqlType() {
	}

	public String get(ResultSet rs, String name) throws SQLException {
		return rs.getString(name);
	}

	public final void set(PreparedStatement st, String value, int index)
			throws SQLException {
		if (value == null)
			st.setNull(index, sqlType());
		else
			st.setString(index, value);
	}

	public int sqlType() {
		return Types.VARCHAR;
	}
}
